import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import router from './router'
import { PiniaVuePlugin, createPinia } from 'pinia'
import { chat } from './chat';
import { initMic } from './chat/call'

import 'normalize.css'

import { initUni, isTabbarView } from './uni'

window.setStatusBarHeight = height => {
  document.getElementById('status-bar-height-var')?.remove()
  const style = document.createElement('style')
  style.id = 'status-bar-height-var'
  style.innerHTML= `
    :root {
      --status-bar-height: ${height}px
    }
  `
  document.head.appendChild(style)
}

window.routerBack = () => {
  router.back()
}

Vue.config.productionTip = false
Vue.use(PiniaVuePlugin)
Vue.use(VueRouter)

initMic()
initUni()
const pinia = createPinia()

new Vue({
  router,
  pinia,
  render: h => h(App),
  created() {
    chat.init()
  }
}).$mount('#app')
